<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 门店管理
 */
namespace app\allwin\model;
use think\Model;

class AllwinStoreChain extends Model{


    //主店铺
    public function store(){
        return $this->hasOne('AllwinStore','id','store_id');
    }

     /**
     * 置顶或取消
     * @param integer $id
     */
    public static function isType(int $id){
        $result = self::where(['id' => $id])->field('types')->find();
        $result->types = $result->types ? 0 : 1;
        return $result->save();
    } 
}